package com.wx.wxpush.mapper;

import com.wx.wxpush.entiy.TempData;
import com.wx.wxpush.entiy.TemplateData;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface PushersMapper {

    @Select(" Select openid from userinfo ")
    List<String> selectAllOpenid();

   @Select("select so.openid,so.appid,so.secret,morning_template_id as morningTemplateId,eve_template_id as eveTemplateId," +
           "riqi,tianqi,low,high,caihongpi,lianai,shengri,jinju,beizhu,district,lianaitime,birthday ,remark " +
           "from sys_openid so LEFT JOIN userinfo u on so.openid=u.openid LEFT JOIN cron c on so.openid = c.openid " +
           "WHERE so.openid=#{openid} and c.cronmoring=#{cron}")
   TempData selectByOpenid(String openid,String cron);

    @Select("select so.openid,so.appid,so.secret,morning_template_id as morningTemplateId,so.secret,eve_template_id as eveTemplateId," +
            "riqi,tianqi,low,high,caihongpi,lianai,shengri,jinju,beizhu,district,lianaitime,birthday,remark  " +
            "from sys_openid so LEFT JOIN userinfo u on so.openid=u.openid LEFT JOIN cron c on so.openid = c.openid " +
            "WHERE so.openid=#{openid} and c.cornnight=#{cornnight}")
    TempData selectByOpenidNight(String openid, String cornnight);

    @Select("select so.openid,so.appid,so.secret,morning_template_id as morningTemplateId,so.secret,eve_template_id as eveTemplateId," +
            "riqi,tianqi,low,high,caihongpi,lianai,shengri,jinju,beizhu,district,lianaitime,birthday,remark  " +
            "from sys_openid so LEFT JOIN userinfo u on so.openid=u.openid LEFT JOIN cron c on so.openid = c.openid " +
            "WHERE so.openid=#{openid}")
    TempData selectByOpenids(String openids);
}
